(function (a) {
    a.guang.judgement = {identityCallback:function () {
    }, repeatIdentityClk:function () {
    }, awardClk:function () {
        var b = '<div id="awardDialog" class="g-dialog" style="width:400px;z-index: 9999; top: 363.5px; left: 643px; position: fixed; display: block; "><div class="dialog-content"><div class="hd"><h3>你喜欢，逛买单</h3></div><div class="bd clearfix tac"><span style="color:#E26;font-size:16px;font-weight:bold;line-height:30px;">恭喜，你中奖了</span><br/><span style="font-size:14px;line-height:30px;">请在规定时间内领取神秘奖品</span><br/><a href="' +
            GUANGER.path + '/account/award" target="_blank" class="bbl-btn award-tag mt20" style="margin-left:148px;cursor:pointer;">查看</a></div><a class="close" href="javascript:;"></a></div></div>';
        a("body").append(b);
        a("#awardDialog").overlay({top:"center", mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!0, load:!0, onClose:function () {
            a("#awardDialog,#exposeMask").remove()
        }});
        a(".award-tag").unbind();
        a(".award-tag").bind("click", function () {
            a("#awardDialog,#exposeMask").overlay().close();
            return!0
        })
    },
        identityOper:function (b, c, d) {
            var e = "0" == d ? "/baobei/favor" : "/baobei/identity", h = "";
            b.data("sid") && (h = b.data("sid"));
            a.ajax({url:GUANGER.path + e, type:"post", dataType:"json", data:{productId:c, identify:"1" == d ? "1" : "0", sid:h}, success:function (c) {
                switch (c.code) {
                    case 100:
                        a.guang.judgement.identityCallback(b, d);
                        break;
                    case 101:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                        a.guang.tip.show(b, c.msg);
                        break;
                    case 103:
                        a.guang.judgement.repeatIdentityClk(b, c.desirable);
                        break;
                    case 666:
                        a.guang.judgement.awardClk(b)
                }
            }})
        },
        cmtSubmitOkClk:function () {
        }, cmtSubmitErrorClk:function () {
        }, cmtSubmit:function (b, c, d) {
            var e = a.guang.util.trim(d.find("textarea[name='commentContent']").val()), h = d.find("input[name='commentType']").val();
            c.find(".error-row");
            $this = d;
            "" != e && 2 <= a.guang.util.getStrLength(e) ? 1E3 > a.guang.util.getStrLength(e) ? a.ajax({url:GUANGER.path + "/baobei/comment", type:"post", dataType:"json", data:{productId:b, commentContent:e, commentType:h}, success:function (b) {
                switch (b.code) {
                    case 100:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-ok";
                        a.guang.tip.show($this, "评论发表成功！");
                        a.guang.judgement.cmtSubmitOkClk();
                        break;
                    case 101:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show($this, b.msg), a.guang.judgement.cmtSubmitErrorClk()
                }
            }}) : (a.guang.tip.conf.tipClass = "tipmodal tipmodal-general", a.guang.tip.show($this, ">_< 评论内容不能超过1000个汉字！")) : (a.guang.tip.conf.tipClass = "tipmodal tipmodal-general", a.guang.tip.show($this, ">_< 你的评论太短啦，再多说几句吧!"))
        },
        commentAndAddTagsSubmitOkClk:function () {
        }, commentAndAddTagsSubmitErrorClk:function () {
        }, commentAndAddTagsSubmit:function (b, c) {
            $this = c;
            a.ajax({url:GUANGER.path + "/baobei/commentMore", type:"post", dataType:"json", data:b, success:function (b) {
                switch (b.code) {
                    case 100:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-ok";
                        a.guang.tip.show($this, "评论发表成功！");
                        a.guang.judgement.commentAndAddTagsSubmitOkClk(b);
                        break;
                    case 101:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                        a.guang.tip.show($this,
                            b.msg);
                        a.guang.judgement.commentAndAddTagsSubmitErrorClk(b);
                        break;
                    case 444:
                        alert("你已被禁止登录！");
                        window.location.href = "http://guang.com/logout";
                        break;
                    case 440:
                        alert("你已被禁言！");
                        a.guang.judgement.commentAndAddTagsSubmitErrorClk(b);
                        break;
                    case 441:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show($this, "亲,操作过快了哦,休息片刻！")
                }
            }})
        }, taolunzuLikeCallback:function () {
        },
        repeattaolunzuLikeClk:function () {
        }, taolunzuLikeSubmit:function (b, c) {
            var d = a.extend({url:"", type:"post", dataType:"json", data:{}}, c || {});
            a.ajax({url:d.url, type:d.type, dataType:d.dataType, data:d.data, success:function (c) {
                switch (c.code) {
                    case 100:
                        a.guang.judgement.taolunzuLikeCallback(b, c);
                        break;
                    case 101:
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                        a.guang.tip.show(b, c.msg);
                        break;
                    case 103:
                        a.guang.judgement.repeattaolunzuLikeClk(b, c);
                        break;
                    case 200:
                        a.guang.dialog.login()
                }
            }})
        }};
    a.guang.cmt = {limitMinNum:4,
        limitMaxNum:1E3, lkCommentSubmitOkClk:function () {
        }, lkComment:function (b) {
            var c = a("#J_HiddenProductId").val();
            a("#cmtDialog")[0] ? (a("#cmtDialog").find("textarea").val(""), a("#cmtDialog").fadeIn()) : (a("body").append('<div id="cmtDialog" class="c-dialog"><p class="title clearfix"><a class="cmtclose fr" href="javascript:;">x</a>喜欢了~</p><div id="cmt-form"><div class="error-row error-like"><p class="error"></p></div><div><textarea class="cmt-txa" name="commentContent" placeholder="说说喜欢的理由吧~"></textarea><input type="hidden" name="commentType" value="0"/></div><div class="cmt-act tar"><input type="submit" id="J_LkCommentSubmit" class="pub" value="发布"/></div></div>'),
                a(".cmt-txa").focus(function () {
                    var b = a("#cmtDialog").offset().top;
                    a("#cmtDialog").css({top:b - 50 + "px", height:104});
                    a(this).height(50);
                    a(".cmt-txa").unbind("focus")
                }));
            var d = a.guang.util.getPosition(b).topMid(), e = a("#cmtDialog").outerWidth(), h = a("#cmtDialog").outerHeight();
            a("#cmtDialog").css({left:d.x - e / 2 + "px", top:d.y - h - 12 + "px"}).fadeIn();
            var f = "true";
            a("#J_LkCommentSubmit").unbind("click").click(function (d) {
                d.preventDefault();
                if (f == "false")return false;
                f = "false";
                a("#J_HiddenProductId")[0] || (c = b.attr("data-proid"));
                a.guang.judgement.cmtSubmitOkClk = function () {
                    a("#cmtDialog").fadeOut();
                    a.guang.cmt.lkCommentSubmitOkClk(a.guang.util.trim(a("#cmtDialog").find("textarea[name='commentContent']").val()))
                };
                a.guang.judgement.cmtSubmit(c, a("#cmtDialog"), a("#cmt-form"), "like");
                f = "true"
            });
            a(".cmtclose").unbind("click").click(function () {
                a("#cmtDialog").fadeOut()
            })
        }, commentSubmitOkClk:function () {
        }, comment:function (b) {
            var c = b.attr("data-type"), d = a("#J_HiddenProductId").val();
            if (a("#commentDialog")[0])a("#commentDialog").data("overlay").load(),
                a("#commentDialog").find("textarea").text(""); else {
                a("body").append('<div id="commentDialog" class="g-dialog"><div class="dialog-content"><div class="hd"><h3>添加评论</h3></div><div class="bd clearfix"><div id="comment-form"><div class="error-row error-worth"><p class="error worth-error"></p></div><div class="form-row">' + ('<textarea class="b-textarea cmt-txa" name="commentContent" placeholder="说说你的理由吧~"></textarea><input type="hidden" name="commentType" value="' +
                    c + '"/></div>') + '<div class="clearfix"><input type="submit" class="bbl-btn pub" id="J_WorthCommentSubmit" value="发布"/></div></div></div><a class="close" href="javascript:;"></a></div></div>');
                a("#commentDialog").overlay({top:"center", mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!1, load:!0});
                var e = "true";
                a("#J_WorthCommentSubmit").click(function () {
                    if ("false" == e)return!1;
                    e = "false";
                    a("#J_HiddenProductId")[0] || (d = b.attr("data-proid"));
                    a.guang.judgement.cmtSubmitOkClk = function () {
                        a("#commentDialog").overlay().close();
                        a.guang.cmt.commentSubmitOkClk(a.guang.util.trim(a("#commentDialog").find("textarea[name='commentContent']").val()))
                    };
                    a.guang.judgement.cmtSubmit(d, a("#commentDialog"), a("#comment-form"), "worth");
                    e = "true"
                })
            }
        }, commentAndAddTagsSubmitOkClk:function () {
        }, commentAndAddTags:function (b, c, d, e, h, f, j, k) {
            b.attr("data-proname") && 0 < b.attr("data-proname").length && (e = b.attr("data-proname"));
            b.attr("data-proimgsrc") && 0 < b.attr("data-proimgsrc").length && (h = b.attr("data-proimgsrc"));
            b.attr("data-prourl") && 0 < b.attr("data-prourl").length &&
            (f = b.attr("data-prourl"));
            var m = function (c, d, i) {
                var j = {}, k = {identify:"", bought:""}, n = "评论", m = "我觉得这个宝贝：", d = "1" == d ? "" : '<input type="checkbox" id="J_Bought" name="bought"/>', o = '<a href="javascript:void(0);" class="radioclick worth-radioclick-off mr10" name="worth" data-type="1"><span>值得</span></a><a href="javascript:void(0);" class="radioclick worth-radioclick-off mr10" name="worth" data-type="0"><span>不值得</span></a>', p = "说说你的理由吧~";
                jQuery.trim(c).length && (m = "我认为它：", o = "1" == c ? '<span class="ml10 mr10 fl worth" style="color:#090">值得</span>' : '<span class="ml10 mr10 fl worth" style="color:#F60">不值得</span>');
                0 == b.data("type") ? (n = "喜欢了～", j.like = 1, p = "说说喜欢的理由呗～") : 1 == b.data("type") || 2 == b.data("type") ? (n = "鉴定", o = 1 == b.data("type") ? '<span class="ml10 mr10 fl worth" style="color:#090">值得</span>' : '<span class="ml10 mr10 fl worth" style="color:#F60">不值得</span>',
                    j.identify = 1 == b.data("type") ? 1 : 0) : 3 == b.data("type") && (n = "评论", p = "");
                c = "";
                if (i[0])for (var q = 0; q < i.length; q++)c += "<li>" + i[q] + "</li>";
                i = '<div id="commentDialog" class="g-dialog" style="z-index: 9999; top: 363.5px; left: 643px; position: fixed; display: block; "><div class="dialog-content"><div class="hd"><h3>' + n + '</h3></div><div class="bd clearfix"><div id="comment-form"><div class="error-row error-worth"><p class="error worth-error"></p></div><div class="commentText-row"><div class="commentText-hd clearfix"><h4 class="fl">' +
                    m + "</h4>" + o + '<span class="bought fl">' + d + '<label for="J_Bought">我买过</label></span></div><div class="commentText-bd"><textarea class="b-textarea cmt-txa" name="commentContent" id="J_CommentContent" placeholder="' + p + '"></textarea></div></div><div class="commentTags-row"><h4>宝贝标签<span>（多个标签用空格、中文或英文逗号隔开）</span>：</h4><input class="b-input" type="input" name="commentTags" id="J_CommentTags"/></div><div class="usedTags-row"><h4>常用标签：</h4><ul class="clearfix">' +
                    c + '</ul></div><div class="clearfix pt10"><input type="submit" class="bbl-btn pub" id="J_WorthCommentSubmit" value="\u786e\u5b9a"><div class="share-comment"><span class="gc">同步分享：</span><ul id="J_UserSns"></ul><span><a href="' + GUANGER.path + '/account/sns" target="_blank">\u8bbe\u7f6e</a></span></div><div class="taobao-favorite"><input type="checkbox" id="J_Taobaofavorite"/><label for="J_Taobaofavorite">收藏到淘宝</label></div></div></div></div><a class="close" href="javascript:;"></a></div></div>';
                a("body").append(i);
                a("#commentDialog").overlay({top:"center", mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!1, load:!0, onClose:function () {
                    a("#commentDialog,#exposeMask").remove()
                }});
                var r = {type_3:'<li class="share-switch ss-sina-btnclick-on btnclick" data-status="on" data-snsid="3" data-webname="ss-sina"></li>', type_5:'<li class="share-switch ss-tencent-btnclick-on btnclick" data-status="on" data-snsid="5" data-webname="ss-tencent"></li>'}, s = a("#J_UserSns");
                a.ajax({url:GUANGER.path + "/account/getUserSns.html",
                    type:"post", dataType:"json", success:function (b) {
                        if (b.code == 100) {
                            for (var c = "", b = b.userSns, d = 0; d < b.length; d++)r["type_" + b[d]] && (c = c + r["type_" + b[d]]);
                            s.append(c);
                            a(".btnclick").bind("click", function () {
                                var b = a(this), c = b.attr("data-webname") + "-btnclick-on", d = b.attr("data-webname") + "-btnclick-off";
                                b.data("status") == "on" ? b.removeClass(c).addClass(d).data("status", "off") : b.removeClass(d).addClass(c).data("status", "on")
                            })
                        }
                    }});
                a(".usedTags-row li").click(function () {
                    var b = a("#J_CommentTags").val().replace(/^[，\,]+/,
                        "").replace(/[，\,]+$/, ""), c = "," + b + ",", d = a(this);
                    if (d.hasClass("selected")) {
                        b = "," + d.text() + ",";
                        for (c = c.replace(b, ","); c.indexOf(b) >= 0;)c = c.replace(b, ",");
                        c = c.replace(/^[，\,]+/, "").replace(/[，\,]+$/, "");
                        a("#J_CommentTags").val(c);
                        d.removeClass("selected")
                    } else {
                        c = b.length ? b + "," + d.text() : d.text();
                        if (a.guang.util.getStrLength(a.guang.util.htmlToTxt(c)) <= 64) {
                            a("#J_CommentTags").val(c);
                            d.addClass("selected")
                        } else {
                            a.guang.tip.conf.tipClass = "tipmodal tipmodal-general";
                            a.guang.tip.show(d, ">_< 标签内容不能超过64个汉字！")
                        }
                    }
                });
                a("#J_CommentTags").keyup(function () {
                    var b = this.value;
                    if (a.guang.util.getStrLength(a.guang.util.htmlToTxt(b)) <= 64) {
                        a(this);
                        for (b = b.replace(/，|\s+/g, ","); b.indexOf(",,") >= 0;)b = b.replace(",,", ",");
                        for (var c = b.split(","), d = 0, e = false; d < c.length; d++) {
                            var h = c[d];
                            if (a.guang.util.htmlToTxt(h).length > 14) {
                                e = true;
                                c[d] = a.guang.util.substring4ChAndEn(h, 14)
                            }
                        }
                        e && (b = c.join(","));
                        if (b != this.value)this.value = b;
                        a(".usedTags-row li").each(function () {
                            var b = a(this);
                            ("," + this.value + ",").indexOf("," + b.text() + ",") >=
                                0 ? b.hasClass("selected") || b.addClass("selected") : b.hasClass("selected") && b.removeClass("selected")
                        })
                    } else this.value = a.guang.util.substring4ChAndEn(b, 64)
                });
                a(".radioclick").click(function () {
                    var b = a(this), c = b.attr("name") + "-radioclick-on", d = b.attr("name") + "-radioclick-off";
                    if (b.hasClass(c))b.removeClass(c).addClass(d); else {
                        a("." + c).removeClass(c).addClass(d);
                        b.removeClass(d).addClass(c)
                    }
                });
                var l = "true";
                a("#J_WorthCommentSubmit").click(function () {
                    var c = a(this);
                    if (l == "false")return false;
                    l = "false";
                    var d =
                        a("#J_CommentContent").val(), g = a("#J_CommentTags").val();
                    if (d != "" && a.guang.util.getStrLength(d) >= 2) {
                        if (a.guang.util.getStrLength(d) > 1E3) {
                            a.guang.tip.conf.tipClass = "tipmodal tipmodal-general";
                            a.guang.tip.show(c, ">_< 评论内容不能超过1000个汉字！");
                            l = "true";
                            return false
                        }
                    } else {
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-general";
                        a.guang.tip.show(c, ">_< 你的评论太短啦，再多说几句吧！");
                        l = "true";
                        return false
                    }
                    if (a.guang.util.getStrLength(g) > 64) {
                        a.guang.tip.conf.tipClass = "tipmodal tipmodal-general";
                        a.guang.tip.show(c, ">_< 标签内容不能超过64个汉字！");
                        l = "true";
                        return false
                    }
                    if (a("#J_Bought:checked").length > 0) {
                        j.bought = 1;
                        k.bought = "1"
                    }
                    if (a(".worth-radioclick-on").length > 0) {
                        j.identify = parseInt(a(".worth-radioclick-on").eq(0).attr("data-type"), 10);
                        k.identify = a(".worth-radioclick-on").eq(0).attr("data-type")
                    }
                    c = {productId:b.attr("data-proid"), sid:b.data("sid") ?
                        b.data("sid") : "", commentContent:d, tagNames:a("#J_CommentTags").val(), snsSiteIds:"", productImgUrl:h, commentContent4Sns:""};
                    a.extend(c, j);
                    if (b.attr("data-type") == "0")c.taobaoFavorite = a("#J_Taobaofavorite")[0].checked ? 1 : 0;
                    if (a("#J_UserSns li").length > 0)for (g = 0; g < a("#J_UserSns li").length; g++)if (a("#J_UserSns li").eq(g).data("status") == "on") {
                        var i = a("#J_UserSns li").eq(g).data("snsid");
                        c.snsSiteIds = c.snsSiteIds + (c.snsSiteIds.length > 0 ? "," + i : i)
                    }
                    g = {"0":"喜欢，", 1:"这宝贝值，推荐：",
                        2:"这宝贝不值：", 3:"评论了《$》:"};
                    i = 135 - a.guang.util.getStrLength(g[b.data("type")] + e + f);
                    c.commentContent4Sns = a.guang.util.getStrLength(d) > i ? g[b.data("type")].indexOf("$") >= 0 ? g[b.data("type")].replace("$", e) + a.guang.util.substring4ChAndEn(d, i) + "..." + f : g[b.data("type")] + a.guang.util.substring4ChAndEn(d, i) + "..." + e + f : g[b.data("type")].indexOf("$") >= 0 ? g[b.data("type")].replace("$", e) + d + "。" + f : g[b.data("type")] + d + "。" + e + f;
                    a.guang.judgement.commentAndAddTagsSubmitOkClk =
                        function (b) {
                            a("#commentDialog").overlay().close();
                            a.guang.cmt.commentAndAddTagsSubmitOkClk(b, k)
                        };
                    a.guang.judgement.commentAndAddTagsSubmitErrorClk = function (b) {
                        b.code == 440 && a("#commentDialog").overlay().close();
                        l = "true"
                    };
                    a.guang.judgement.commentAndAddTagsSubmit(c, a(this))
                })
            };
            "fromNonDetail" == k ? a.ajax({url:GUANGER.path + "/baobei/getUserIdentifyAndBuyAndTag.html", type:"post", dataType:"json", data:{productId:b.attr("data-proid")}, success:function (a) {
                if (100 == a.code) {
                    var b = [];
                    if (a.tagList[0])for (var c = 0; c <
                        a.tagList.length; c++)b[b.length] = a.tagList[c].tagKeyword;
                    m(a.identify, a.bought, b)
                }
            }}) : m(c, d, j)
        }};
    a.guang.addToTopic = {proId:"", topicsOptions:"", galleryOptions:"", galleryId:"", sceneId:"", submitData:{}, isEnable:!0, submit:function () {
        if (a.guang.addToTopic.isEnable)a.guang.addToTopic.isEnable = !1; else return!1;
        a.ajax({url:GUANGER.path + "/u/topic/addProductFromList", type:"post", dataType:"json", data:a.guang.addToTopic.submitData, success:function (b) {
            switch (b.code) {
                case 100:
                    var c = a("#J_AddToTopicD");
                    c.overlay().close();
                    c.find("input[type=text]").val("");
                    c.find("textarea").val("");
                    c.find("input[name='topicType'][value=0]").attr("checked", !0);
                    b = '<p class="success-text"><span class="correct">加入主题成功！</span></p>' + ('<p class="clearfix"><a class="bbl-btn goCheck" href="' + GUANGER.path + "/jie/" + b.url + '">查看我的主题</a>');
                    a.guang.tipForOper.conf.html = b + '<a class="bgr-btn closeD ml10" href="javascript:;">关闭</a></p>';
                    a.guang.tipForOper.init();
                    setTimeout(function () {
                            a("#J_TipForOper").fadeOut()
                        },
                        2E3);
                    setTimeout(function () {
                        a.guang.addToTopic.isEnable = !0
                    }, 1E3);
                    break;
                case 101:
                    a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                    a.guang.tip.show($this, "加入主题失败");
                    break;
                case 102:
                    a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                    a.guang.tip.show($this, "参数错误");
                    break;
                case 300:
                    a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show($this, "亲，您可能未登录！")
            }
        }, error:function () {
            a.guang.tip.conf.tipClass =
                "tipmodal tipmodal-error";
            a.guang.tip.show($this, "亲，您可能未登录！刷新再试下吧！")
        }})
    }, relateScene:function (b, c) {
        var d = a("#J_SelScene")[0];
        "" != b ? (a("#J_SelCag").val(b), a.ajax({url:GUANGER.path + "/u/topic/getScenario", type:"post", dataType:"json", data:{gallery:b}, success:function (a) {
            switch (a.code) {
                case 100:
                    d.options.length = 0;
                    d.options[0] = new Option("选择场景", "");
                    for (var a = a.scenarioList, b = a.length, f = 0; f < b; f++)d.options[f +
                        1] = new Option(a[f].name, a[f].id);
                    c && (d.value = c);
                    break;
                case 110:
                    d.options.length = 0;
                    d.options[0] = new Option("选择场景", "");
                    break;
                case 102:
                    alert("哎呀~ 出错了！")
            }
        }})) : (d.options.length = 0, d.options[0] = new Option("选择场景", ""))
    }, dialog:function () {
        if (a("#J_AddToTopicD")[0])a("#J_AddToTopicD").data("overlay").load(); else {
            a("body").append('<div id="J_AddToTopicD" class="g-dialog ilike-topic-dialog"><div class="dialog-content"><div class="hd"><h3>加入我的主题</h3></div><div class="bd clearfix"><ul><li id="J_HasTopicList"><label><input type="radio" name="topicType" checked="checked" value="0"/>已有主题：</label><select id="J_SelTopic"></select></li><li id="J_NewTopic"><label><input type="radio" name="topicType" value="1"/>新的主题：</label><input class="b-input" type="text" value=""/></li><li class="gallery-scene" id="J_GalleryScene" style="display:none;"><select id="J_SelCag" name="gallerys" class="sel-cag"><option value="">选择分类</option></select><select id="J_SelScene" name="selScene"><option value="">选择场景</option></select></li><li><textarea class="b-textarea" placeholder="说两句"></textarea></li></ul><div class="clearfix pt10"><input type="button" class="bbl-btn ok" value="完成"/><input type="button" class="bgr-btn cancel" value="取消"></div></div><a class="close" href="javascript:;"></a></div></div>');
            var b = a("#J_AddToTopicD");
            b.width("365");
            b.overlay({top:"center", fixed:!1, mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!1, load:!0});
            var c = a("#J_NewTopic").find("input[type=text]"), d = a("#J_SelTopic"), e = a("#J_GalleryScene");
            c.focus(function () {
                b.find("input[name='topicType'][value=1]").attr("checked", !0);
                e.fadeIn()
            });
            d.html(a.guang.addToTopic.topicsOptions);
            d.change(function () {
                b.find("input[name='topicType'][value=0]").attr("checked", !0);
                e.fadeOut()
            });
            a("#J_SelCag").change(function () {
                var b =
                    a(this).val();
                a.guang.addToTopic.relateScene(b)
            });
            a("#J_HasTopicList").click(function () {
                e.fadeOut()
            });
            a("#J_NewTopic").click(function () {
                e.fadeIn()
            });
            b.find(".ok").click(function () {
                var d = a(this), e = a.guang.util.trim(b.find("textarea").val());
                if ("1" == b.find("input[name='topicType']:checked").val()) {
                    var j = a.guang.util.trim(c.val());
                    if ("" == j || 15 < a.guang.util.getStrLength(j))a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show(d, "主题标题为1~15个汉字"); else if (1E3 <
                        a.guang.util.getStrLength(e))a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show(d, "评论超过1000汉字了"); else {
                        var k = a("#J_SelCag").val() + "," + a("#J_SelScene").val();
                        a.guang.addToTopic.submitData = {productId:a.guang.addToTopic.proId, topicTitle:j, userComment:e, gallerys:a("#J_SelCag").val(), scenarios:k};
                        a.guang.addToTopic.submit(d)
                    }
                } else 1E3 < a.guang.util.getStrLength(e) ? (a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show(d, "评论超过1000汉字了")) :
                    (a.guang.addToTopic.submitData = {productId:a.guang.addToTopic.proId, topicId:a("#J_SelTopic").val(), userComment:e}, a.guang.addToTopic.submit())
            });
            b.find(".cancel").click(function () {
                b.overlay().close()
            })
        }
    }, init:function (b) {
        if (!a.guang.dialog.isLogin())return!1;
        a.guang.addToTopic.proId = b.data("proid");
        a.guang.addToTopic.dialog();
        a.getJSON(GUANGER.path + "/u/topic/toAddProduct?" + Math.floor(new Date / 10), function (c) {
            switch (c.code) {
                case 100:
                    a("#J_AddToTopicD").find("input[name='topicType'][value=0]").attr("checked",
                        !0);
                    a("#J_HasTopicList").css("display", "block");
                    a("#J_GalleryScene").css("display", "none");
                    var d = [];
                    a.map(c.userTopics, function (a) {
                        d.push('<option value="' + a.id + '">' + a.title + "</option>")
                    });
                    a.guang.addToTopic.topicsOptions = d.join("");
                    a("#J_SelTopic").html(a.guang.addToTopic.topicsOptions);
                    break;
                case 101:
                    a.guang.tip.conf.tipClass = "tipmodal tipmodal-error";
                    a.guang.tip.show(b, "获取主题失败，刷洗页面再试一下！");
                    break;
                case 110:
                    a.guang.addToTopic.topicsOptions =
                        "";
                    a.guang.addToTopic.dialog();
                    a("#J_HasTopicList").css("display", "none");
                    a("#J_AddToTopicD").find("input[name='topicType'][value=1]").attr("checked", !0);
                    a("#J_GalleryScene").fadeIn();
                    break;
                case 300:
                    a.guang.tip.conf.tipClass = "tipmodal tipmodal-error", a.guang.tip.show(b, "亲，您可能未登录哦！")
            }
            var e = [];
            e.push('<option value="">选择分类</option>');
            a.map(c.galleryList, function (a) {
                e.push('<option value="' + a.id + '">' + a.name + "</option>")
            });
            a.guang.addToTopic.galleryOptions =
                e.join("");
            a("#J_SelCag").html(a.guang.addToTopic.galleryOptions);
            void 0 != b.data("galleryid") && void 0 != b.data("sceneid") && (a.guang.addToTopic.galleryId = b.data("galleryid"), a.guang.addToTopic.sceneId = b.data("sceneid"), a.guang.addToTopic.relateScene(a.guang.addToTopic.galleryId, a.guang.addToTopic.sceneId))
        })
    }};
    a(".ilike-topic").die().live("click", function () {
        a.guang.addToTopic.init(a(this))
    })
})(jQuery);
(function (a) {
    a.guang.productDiscount = {productMerchantId:"", productId:"", setData:function () {
        a.ajax({url:GUANGER.path + "/baobei/getDiscount?" + Math.floor(new Date / 10), type:"post", dataType:"json", data:{productMerchantId:a.guang.productDiscount.productMerchantId, productId:a.guang.productDiscount.productId}, success:function (b) {
            var c = a("#J_ProductDiscountD");
            switch (b.code) {
                case 100:
                    c.find(".discount-code").html("逛" + b.discountCode);
                    c.find(".discount-number").html(b.discountNumber);
                    c.find(".shop-url").attr("href",
                        "http://" + b.shopUrl);
                    break;
                case 101:
                    c.find(".bd").html('<p class="msg error r3">亲，程序错误~</p>');
                    break;
                case 102:
                    c.find(".bd").html('<p class="msg erro r3">亲，参数错误~</p>');
                    break;
                case 110:
                    c.find(".bd").html('<p class="msg error r3">亲，该店铺优惠已结束~</p>');
                    break;
                case 200:
                    c.find(".bd").html('<p class="msg error r3">亲，您还没登陆哦~</p>')
            }
        }, error:function () {
            $discountDialog.find(".bd").html('<p class="msg error r3">亲，服务器连不上了，联系逛逛MM哦~~</p>')
        }})
    },
        guangVipDialog:function (b) {
            if (!a.guang.dialog.isLogin())return!1;
            a.guang.productDiscount.productId = b.data("proid");
            if (a("#J_GuangVipD")[0])a("#J_GuangVipD").data("overlay").load(); else {
                a("body").append('<div id="J_GuangVipD" class="g-dialog discount-dialog"><div class="dialog-content"><div class="hd"><h3>有惊喜！</h3></div><div class="bd clearfix"><p class="vip-desc">现在购买这个宝贝，有逛逛会员的专享优惠哦！</p><div class="clearfix pt20"><a class="bbl-btn J_GetDiscountBtn">领取优惠</a><a class="bgr-btn cancel">取消</a></div></div><a class="close" href="javascript:;"></a></div></div>');
                var c = a("#J_GuangVipD");
                c.width("350");
                c.overlay({top:"center", fixed:!1, mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!1, load:!0});
                c.find(".J_GetDiscountBtn").click(function () {
                    a("#exposeMask").remove();
                    a.guang.productDiscount.init(a(this))
                });
                c.find(".cancel").click(function () {
                    c.overlay().close()
                })
            }
        }, getDiscountDialog:function () {
            if (a("#J_ProductDiscountD")[0])a("#J_ProductDiscountD").data("overlay").load(); else {
                a("body").append('<div id="J_ProductDiscountD" class="g-dialog discount-dialog"><div class="dialog-content"><div class="hd"><h3>领优惠~</h3></div><div class="bd clearfix"><ul><li><label>你的优惠码:</label><strong class="discount-code">逛</strong></li><li><label>优惠幅度:</label><span class="discount-number">75折</span></li><li class="clearfix"><label>如何使用:</label> <p>1、联系店铺客服，报你的优惠码<br/>2、在客服指导下，以优惠价完成购买</p></li></ul><div class="clearfix pt20"><a class="bbl-btn shop-url" href="http://guang.com">去店铺&gt;</a><a class="bgr-btn cancel">取消</a><a class="shop-post" href="http://guang.com/forum/post/3363" target="_blank">商家报名&gt;</a></div></div><a class="close" href="javascript:;"></a></div></div>');
                var b = a("#J_ProductDiscountD");
                b.width("350");
                b.overlay({top:"center", fixed:!1, mask:{color:"#000", loadSpeed:200, opacity:0.3}, closeOnClick:!1, load:!0});
                b.find(".cancel").click(function () {
                    b.overlay().close()
                })
            }
        }, init:function (b) {
            if (!a.guang.dialog.isLogin())return!1;
            b.data("merchantid") && "" != b.data("merchantid") && (a.guang.productDiscount.productMerchantId = b.data("merchantid"));
            b.data("proid") && "" != b.data("proid") && (a.guang.productDiscount.productId = b.data("proid"));
            a.guang.productDiscount.getDiscountDialog();
            a.guang.productDiscount.setData()
        }};
    a(".ilike-m[rel=proDiscount]").click(function () {
        a.guang.productDiscount.guangVipDialog(a(this))
    })
})(jQuery);
